(function() {
    'use strict';
    angular.module("webApp").controller("ReturnreportCtrl", ReturnreportCtrl);
    ReturnreportCtrl.$inject = ['$scope', 'dataService', '$location', '$state', 'helper'];

    function ReturnreportCtrl($scope, dataService, $location, $state, helper) {
        $scope.listAction = function() {
            $scope.page_Size = 0;
            $scope.returnreportList(1);
        }
        $scope.returnreportList = function(page_No) {
            var query = { page_no: page_No, page_size: $scope.page_Size };
            if ($scope.partner_id) {
                query.query = { partner_id: partner_id }
            }
            dataService.returnreportGet(query).then(function(result) {
                if (result.Msg) {
                    helper.myAlert("error:" + result.Msg);
                } else {
                    $scope.returnreports = result.shop;
                    $scope.returnreportsTotal = result.total_count;
                }
            });
        }
        $scope.infoAction = function() {
            var partner_id = $location.serach().partner_id;
            dataService.returnreportOne(partner_id).then(function(returnreport) {
                if (returnreport.Msg) {
                    helper.myAlert("error:" + returnreport.Msg);
                } else {
                    $scope.returnreport = returnreport
                }
            });
        }
    }
})();